import sys

def strxor(a, b):     # xor two strings of different lengths
    if len(a) > len(b):
        return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a[:len(b)], b)])
    else:
        return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b[:len(a)])])

def random(size=16):
    return open("/dev/urandom").read(size)

def encrypt(key, msg):
    c = strxor(key, msg)
    print
    print c.encode('hex')
    return c

a = "12104c06134e5709140f104f02521b0a0442020c4d070b184f4815541f0800484e1e0241061d064d540b0a020210194510164d4f3a005343004e430e1e1d0a524612171b0117001b0e45431c0c1d160a520d11744e19061a114d0e55174f084e543714050b174353541b48070e000e4d".decode('hex')
b = "030d45430f07430341171c061c475409074f1b014d290017595d5a51570007484e1e02411911550e521a1f191f120604021b4b52244543020f4e441305050a0007410f1b1b524f124803410016144206135242150d572d150600234f0a0a0f".decode('hex')
c = "111d09451c49140a55180c491e154f03030d190d002e0b0f16154f0548080700000000001f0c53430611151b1d021f41120d061d1e4510410f00071d1b180052415318001a454f094646021c1a09540c415f5361434e2b0f174d2d1a1d4507".decode('hex')
d = ""
e = ""
f = ""
for i in range(min(len(a), len(b), len(c))):
    if (ord(a[i]) > 63) and (ord(b[i]) > 63) and (ord(c[i]) < 64):
         d = d + " "
	 e = e + chr(ord(a[i]) ^ ord(" "))
	 f = f + chr(ord(b[i]) ^ ord(" "))
    else :
	 if (ord(a[i]) > 63) and (ord(b[i]) < 64) and (ord(c[i]) > 63):
	      d = d + chr(ord(a[i]) ^ ord(" "))
              e = e + " "
	      f = f +chr(ord(c[i]) ^ ord(" "))	
	 else:
             if (ord(a[i]) < 64) and (ord(b[i]) > 63) and (ord(c[i]) > 63):
                 d = d + chr(ord(b[i]) ^ ord(" "))
		 e = e + chr(ord(c[i]) ^ ord(" "))		 
		 f = f +" "
	     else :
		 d = d + "?"
		 e = e + "?"		 
		 f = f + "?"
print "d=" + d
print "e=" + e
print "f=" + f